//
//  WYCMeTamController.m
//  51信用卡
//
//  Created by 中企互联 on 2017/11/16.
//  Copyright © 2017年 中企互联. All rights reserved.
//

#import "WYCMeTamController.h"
#import "WYCTeamCell.h"

@interface WYCMeTamController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView * tableView;
@end

@implementation WYCMeTamController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //Nav
    [self setupNav];
    
    //创建头部
    [self setupCreat];
    
}
#pragma make ------->>创建头部
- (void)setupCreat{
    
    //头部背景
    UIView * headerView = [[UIView alloc] init];
    headerView.frame = CGRectMake(0, 64, ScreenWidth, 620 * px);
    headerView.backgroundColor = bigredColor;
    [self.view addSubview:headerView];
    
    
    //金额
    UILabel * moneylabel = [[UILabel alloc] init];
    moneylabel.frame = CGRectMake(ScreenWidth / 4, 80 * px, ScreenWidth / 4 * 2, 80 * px);
    moneylabel.textAlignment = NSTextAlignmentCenter;
    moneylabel.text = @"10000";
    moneylabel.textColor = [UIColor whiteColor];
    moneylabel.font = [UIFont boldSystemFontOfSize:SuperBigFont];
    [headerView addSubview:moneylabel];
    
    
    //金额
    UILabel * Profitlabel = [[UILabel alloc] init];
    Profitlabel.frame = CGRectMake(ScreenWidth / 4, CGRectGetMaxY(moneylabel.frame) + 80 * px, ScreenWidth / 4 * 2, 80 * px);
    Profitlabel.textAlignment = NSTextAlignmentCenter;
    Profitlabel.text = @"总计收益";
    Profitlabel.textColor = [UIColor whiteColor];
    Profitlabel.font = [UIFont boldSystemFontOfSize:BigFont];
    [headerView addSubview:Profitlabel];
    
    
    
    //会员背景
    UIView * backView = [[UIView alloc] init];
    backView.frame = CGRectMake(0, CGRectGetMaxY(Profitlabel.frame) + 80 * px, headerView.width, 220 * px);
    backView.backgroundColor = WYCRGBColor(228, 5, 67);
    [headerView addSubview:backView];
    
    
    //会员人数
    UILabel * TotaVip = [[UILabel alloc] init];
    TotaVip.frame = CGRectMake(0, 40 * px, backView.width / 3, 50 * px);
    TotaVip.textColor = [UIColor whiteColor];
    TotaVip.text = @"40";
    TotaVip.font = forLight;
    TotaVip.textAlignment = NSTextAlignmentCenter;
    [backView addSubview:TotaVip];
    
    
    //总计会员
    UILabel * TotaVipshow = [[UILabel alloc] init];
    TotaVipshow.frame = CGRectMake(0, CGRectGetMaxY(TotaVip.frame) + WYCClearance, backView.width / 3, TotaVip.height);
    TotaVipshow.textColor = [UIColor whiteColor];
    TotaVipshow.text = @"总计会员";
    TotaVipshow.font = forLight;
    TotaVipshow.textAlignment = NSTextAlignmentCenter;
    [backView addSubview:TotaVipshow];
    
    
    //一级会员
    UILabel * aClassVip = [[UILabel alloc] init];
    aClassVip.frame = CGRectMake(backView.width / 3, 40 * px, backView.width / 3, TotaVip.height);
    aClassVip.textColor = [UIColor whiteColor];
    aClassVip.text = @"40";
    aClassVip.font = forLight;
    aClassVip.textAlignment = NSTextAlignmentCenter;
    [backView addSubview:aClassVip];
    
    
    //会员人数
    UILabel * aClassVipshow = [[UILabel alloc] init];
    aClassVipshow.frame = CGRectMake(aClassVip.x, CGRectGetMaxY(aClassVip.frame) + WYCClearance, aClassVip.width, TotaVip.height);
    aClassVipshow.textColor = [UIColor whiteColor];
    aClassVipshow.text = @"一级会员";
    aClassVipshow.font = forLight;
    aClassVipshow.textAlignment = NSTextAlignmentCenter;
    [backView addSubview:aClassVipshow];
    
    
    //一级会员
    UILabel * secondlevelVip = [[UILabel alloc] init];
    secondlevelVip.frame = CGRectMake(backView.width / 3 * 2, 40 * px, backView.width / 3, TotaVip.height);
    secondlevelVip.textColor = [UIColor whiteColor];
    secondlevelVip.text = @"40";
    secondlevelVip.font = forLight;
    secondlevelVip.textAlignment = NSTextAlignmentCenter;
    [backView addSubview:secondlevelVip];
    
    
    //会员人数
    UILabel * secondlevelVipshow = [[UILabel alloc] init];
    secondlevelVipshow.frame = CGRectMake(secondlevelVip.x, CGRectGetMaxY(secondlevelVip.frame) + WYCClearance, aClassVip.width, TotaVip.height);
    secondlevelVipshow.textColor = [UIColor whiteColor];
    secondlevelVipshow.text = @"二级会员";
    secondlevelVipshow.font = forLight;
    secondlevelVipshow.textAlignment = NSTextAlignmentCenter;
    [backView addSubview:secondlevelVipshow];
    
    
    //统计背景
    UIView * StatisticsView = [[UIView alloc] init];
    StatisticsView.frame = CGRectMake(0, CGRectGetMaxY(headerView.frame), backView.width, 150 * px);
    StatisticsView.backgroundColor = WYCRGBColor(221, 221, 221);
    [self.view addSubview:StatisticsView];
    
    
    //一级会员
    UILabel * memberLabel = [[UILabel alloc] init];
    memberLabel.frame = CGRectMake(WYCClearance, WYCClearance, StatisticsView.width / 3, 70 * px);
    memberLabel.text = @"一级会员";
    memberLabel.font = [UIFont systemFontOfSize:BigFont];
    memberLabel.textColor = [UIColor blackColor];
    memberLabel.textAlignment = NSTextAlignmentLeft;
    [StatisticsView addSubview:memberLabel];
    
    
    //总计邀请
    UILabel * InvitationLabel = [[UILabel alloc] init];
    InvitationLabel.frame = CGRectMake(StatisticsView.width / 3, WYCClearance, StatisticsView.width / 3, 70 * px);
    InvitationLabel.text = @"总计邀请";
    InvitationLabel.font = [UIFont systemFontOfSize:BigFont];
    InvitationLabel.textColor = [UIColor blackColor];
    InvitationLabel.textAlignment = NSTextAlignmentCenter;
    [StatisticsView addSubview:InvitationLabel];
    
    
    //总计邀请
    UILabel * MeProfitLabel = [[UILabel alloc] init];
    MeProfitLabel.frame = CGRectMake(StatisticsView.width / 3 * 2, WYCClearance, StatisticsView.width / 3 - WYCClearance, 70 * px);
    MeProfitLabel.text = @"我的收益";
    MeProfitLabel.font = [UIFont systemFontOfSize:BigFont];
    MeProfitLabel.textColor = [UIColor blackColor];
    MeProfitLabel.textAlignment = NSTextAlignmentRight;
    [StatisticsView addSubview:MeProfitLabel];
    
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(StatisticsView.frame), ScreenWidth, ScreenHeight) style:UITableViewStylePlain];
    //    self.tableView.backgroundColor = [UIColor redColor];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    [self.view addSubview:self.tableView];
}

#pragma make ------>>Nav
- (void)setupNav{
    self.view.backgroundColor = WYCbackColor;
    self.navigationItem.title = @"我的团队";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    [self.navigationController.navigationBar setBarTintColor:bigredColor];
    
}
#pragma make ------->>UItableView代理方法,创建数据源数据方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 8;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    return 140 * px;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    tableView.tableFooterView = [[UIView alloc] init];
    WYCTeamCell * cell = [WYCTeamCell cellWithTableView:tableView];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

//#pragma make ------>>进入控制器隐藏
//- (void)viewWillAppear:(BOOL)animated {
//    [super viewWillAppear:animated];
//    
//    [self.navigationController setNavigationBarHidden:YES animated:YES];
//}
//#pragma make ------>>离开控制器显示
//- (void)viewWillDisappear:(BOOL)animated {
//    [super viewWillDisappear:animated];
//    
//    [self.navigationController setNavigationBarHidden:NO animated:YES];
//}

@end
